using MicroMsg.Common.Event;
using MicroMsg.Resource.@string;
using MicroMsg.Storage;
using MicroMsg.UI.Page;
using MicroMsg.UI.Util;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace MicroMsg.UI.UserContrl
{
	public class Dialog2BtnWithImg : UserControl
	{
		public delegate void dismissWithClickBtn(object sender, int nClickIndex);
		private ModeDialogHelper mDlgHelper;
		private bool mBIsFirstLoaded = true;
		public EventWatcher imgReadyWatcher;
		public EventWatcher getContactWatcher;
		private Contact mContact;
		internal Grid LayoutRoot;
		internal TextBlock txtTitle;
		internal Image BackImg;
		internal BrandHeadCtrl brandhead;
		internal TextBlock txtNickName;
		internal TextBlock txtContent;
		internal Button btnLeft;
		internal Button btnRight;
		private bool _contentLoaded;
		public event Dialog2BtnWithImg.dismissWithClickBtn mBtnClick;
		public event TextChangedEventHandler mTxtInTextChangedHandler;
		private Dialog2BtnWithImg(bool isEnableBackKeyPress, string strTitle, Contact contact, string strLeftBtnTitle, string strRightBtnTitle, string strInputBoxHint, Dialog2BtnWithImg.dismissWithClickBtn clickHandler = null, TextChangedEventHandler textChangedHandler = null, string strTxtInContent = null)
		{
			this.InitializeComponent();
			this.mTxtInTextChangedHandler = textChangedHandler;
			base.add_Loaded(new RoutedEventHandler(this.Dialog2BtnWithImg_Loaded));
			this.LayoutRoot.set_Background(R.theme.COMMON_APPBAR_BK_BRUSH);
			this.mContact = contact;
			if (string.IsNullOrEmpty(this.mContact.strUsrName))
			{
				return;
			}
			this.brandhead.ItemObject = this.mContact;
			this.txtTitle.set_Text(strTitle);
			this.txtContent.set_Text(string.Format(strings.FMsgWeiXinId, this.mContact.strUsrName));
			this.btnLeft.set_Content(strLeftBtnTitle);
			this.btnRight.set_Content(strRightBtnTitle);
			this.txtNickName.set_Text(this.mContact.strNickName);
			this.mBtnClick = clickHandler;
			this.mDlgHelper = new ModeDialogHelper(this, isEnableBackKeyPress, (SolidColorBrush)Application.get_Current().get_Resources().get_Item("NearOpacityBrush1"), false);
		}
		private void Dialog2BtnWithImg_Loaded(object sender, RoutedEventArgs e)
		{
			if (this.mBIsFirstLoaded)
			{
				this.mBIsFirstLoaded = false;
			}
		}
		public static Dialog2BtnWithImg Show(string strTitle, Contact contact, string strLeftBtnTitle, string strRightBtnTitle, string strContent2, Dialog2BtnWithImg.dismissWithClickBtn clickHandler = null)
		{
			Dialog2BtnWithImg dialog2BtnWithImg = new Dialog2BtnWithImg(true, strTitle, contact, strLeftBtnTitle, strRightBtnTitle, strContent2, clickHandler, null, null);
			dialog2BtnWithImg.mDlgHelper.Show();
			return dialog2BtnWithImg;
		}
		private void btnLeft_Click(object sender, RoutedEventArgs e)
		{
			base.Focus();
			if (this.mBtnClick != null)
			{
				this.mBtnClick(this, 0);
			}
			this.mDlgHelper.Hide(null);
		}
		private void btnRight_Click(object sender, RoutedEventArgs e)
		{
			base.Focus();
			if (this.mBtnClick != null)
			{
				this.mBtnClick(this, 1);
			}
			this.mDlgHelper.Hide(null);
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/Util/Dialog2BtnWithImg.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.txtTitle = (TextBlock)base.FindName("txtTitle");
			this.BackImg = (Image)base.FindName("BackImg");
			this.brandhead = (BrandHeadCtrl)base.FindName("brandhead");
			this.txtNickName = (TextBlock)base.FindName("txtNickName");
			this.txtContent = (TextBlock)base.FindName("txtContent");
			this.btnLeft = (Button)base.FindName("btnLeft");
			this.btnRight = (Button)base.FindName("btnRight");
		}
	}
}
